<script setup lang="ts">
import {
  Position,
  Search,
  Refresh,
  Plus,
  Delete,
  Edit,
  Upload,
  Download,
  CircleCheck,
  Select,
  Setting,
  FirstAidKit,
  FolderAdd,
  Key,
  Close,
  Check,
  Minus,
  Remove
} from "@element-plus/icons-vue";
import { useAttrs } from "vue";

const emit = defineEmits(["click"]);
const attrs = useAttrs();

interface Props {
  type?: string;
}

const props = withDefaults(defineProps<Props>(), {
  type: "default"
});
</script>

<template>
  <!--  人工封堵-->
  <el-tooltip v-if="type == 'artificial_block_icon_text'" placement="top" content="人工封堵">
    <el-button v-bind="{ ...attrs }" circle type="default" @click="emit('click')">
      <svg
        fill="gray "
        t="1757227583596"
        class="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="4567"
        width="14"
        height="14"
      >
        <path
          d="M512 1024C232.107 1024 0 791.893 0 512S232.107 0 512 0s512 232.107 512 512-232.107 512-512 512z m0-955.733C266.24 68.267 68.267 266.24 68.267 512S266.24 955.733 512 955.733 955.733 757.76 955.733 512 757.76 68.267 512 68.267z"
          p-id="4568"
        ></path>
        <path d="M149.982 825.754l675.84-675.84 48.196 48.332-675.84 675.84z" p-id="4569"></path>
      </svg>
    </el-button>
  </el-tooltip>
  <!--  封堵-->
  <el-tooltip v-if="type == 'block_icon_text'" placement="top" content="封堵">
    <el-button v-bind="{ ...attrs }" circle type="default" @click="emit('click')">
      <svg
        fill="gray "
        t="1757227583596"
        class="icon"
        viewBox="0 0 1024 1024"
        version="1.1"
        xmlns="http://www.w3.org/2000/svg"
        p-id="4567"
        width="14"
        height="14"
      >
        <path
          d="M512 1024C232.107 1024 0 791.893 0 512S232.107 0 512 0s512 232.107 512 512-232.107 512-512 512z m0-955.733C266.24 68.267 68.267 266.24 68.267 512S266.24 955.733 512 955.733 955.733 757.76 955.733 512 757.76 68.267 512 68.267z"
          p-id="4568"
        ></path>
        <path d="M149.982 825.754l675.84-675.84 48.196 48.332-675.84 675.84z" p-id="4569"></path>
      </svg>
    </el-button>
  </el-tooltip>
  <!--  解封-->
  <el-tooltip v-if="type == 'unblock_icon_text'" placement="top" content="解封">
    <el-button v-bind="{ ...attrs }" circle type="default" @click="emit('click')">
      <el-icon>
        <Check />
      </el-icon>
    </el-button>
  </el-tooltip>
  <!--  详情-->
  <el-tooltip v-if="type == 'detail_icon_text'" placement="top" content="详情">
    <el-button v-bind="{ ...attrs }" circle type="default" @click="emit('click')">
      <el-icon>
        <Document />
      </el-icon>
    </el-button>
  </el-tooltip>
  <!--  配置-->
  <el-tooltip v-if="type == 'config_icon_text'" placement="top" content="配置">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Setting" @click="emit('click')" />
  </el-tooltip>
  <!--  连通-->
  <el-tooltip v-if="type == 'connect_icon_text'" placement="top" content="连通">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Select" @click="emit('click')" />
  </el-tooltip>
  <!--  隔离-->
  <el-tooltip v-if="type == 'disabled_icon_text'" placement="top" content="隔离">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Minus" @click="emit('click')" />
  </el-tooltip>
  <!-- 新增 -->
  <!--  <el-button v-if="type == 'add_icon_text'" v-bind="{ ...attrs }" :icon="Plus" type="primary" @click="emit('click')">-->
  <!--    <slot>新增</slot>-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'add_icon_text'" placement="top" content="新增">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Plus" @click="emit('click')" />
  </el-tooltip>
  <el-tooltip v-if="type == 'add_icon'" placement="top" content="新增">
    <el-button v-bind="{ ...attrs }" circle type="primary" :icon="Plus" @click="emit('click')" />
  </el-tooltip>
  <el-button v-if="type == 'add_text'" v-bind="{ ...attrs }" type="primary" link>
    <slot>新增</slot>
  </el-button>
  <!-- 编辑 -->
  <el-button v-if="type == 'edit_icon_text'" v-bind="{ ...attrs }" :icon="Edit" type="primary">编辑</el-button>
  <el-button v-if="type == 'edit_text_plain'" v-bind="{ ...attrs }" type="primary" plain>编辑</el-button>
  <!--  <el-button-->
  <!--    v-if="type == 'edit_text'"-->
  <!--    v-bind="{ ...attrs }"-->
  <!--    type="primary"-->
  <!--    link-->
  <!--  >编辑</el-button-->
  <!--  >-->
  <el-tooltip v-if="type == 'edit_text'" placement="top" content="编辑">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Edit" @click="emit('click')" />
  </el-tooltip>
  <el-tooltip v-if="type == 'edit_icon'" placement="top" content="编辑">
    <el-button v-bind="{ ...attrs }" circle type="primary" :icon="Edit" @click="emit('click')" />
  </el-tooltip>
  <!-- 删除 -->
  <el-tooltip v-if="type == 'del_icon'" placement="top" content="删除">
    <el-button v-bind="{ ...attrs }" circle type="danger" :icon="Delete" @click="emit('click')" />
  </el-tooltip>
  <!--  <el-button v-if="type == 'del_icon_text'" v-bind="{ ...attrs }" :icon="Delete" type="danger" @click="emit('click')"-->
  <!--    >删除-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'del_icon_text'" placement="top" content="删除">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Delete" @click="emit('click')" />
  </el-tooltip>
  <!-- 删除 -->
  <el-tooltip v-if="type == 'del_text'" placement="top" content="删除">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Delete" @click="emit('click')" />
  </el-tooltip>
  <!--  <el-button v-if="type == 'del_text'" v-bind="{ ...attrs }" link type="danger" @click="emit('click')">删除 </el-button>-->

  <el-button v-if="type == 'del_text_plain'" v-bind="{ ...attrs }" type="danger" plain @click="emit('click')">删除</el-button>
  <!-- 搜索 -->
  <!--  <el-button v-if="type == 'search_icon_text'" v-bind="{ ...attrs }" :icon="Search" type="primary" @click="emit('click')"-->
  <!--    >搜索-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'search_icon_text'" placement="top" content="搜索">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Search" @click="emit('click')" />
  </el-tooltip>
  <!-- 重置 -->
  <!--  <el-button v-if="type == 'reset_icon_text'" v-bind="{ ...attrs }" :icon="Refresh" @click="emit('click')">重置 </el-button>-->
  <el-tooltip v-if="type == 'reset_icon_text'" placement="top" content="重置">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Refresh" @click="emit('click')" />
  </el-tooltip>
  <!-- 刷新 -->
  <el-tooltip v-if="type == 'clear_all_icon_text'" placement="top" content="清空">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Delete" @click="emit('click')" />
  </el-tooltip>
  <!--  <el-button v-if="type == 'refresh_icon_text'" v-bind="{ ...attrs }" :icon="Refresh" @click="emit('click')">刷新 </el-button>-->
  <el-tooltip v-if="type == 'refresh_icon_text'" placement="top" content="刷新">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Refresh" @click="emit('click')" />
  </el-tooltip>
  <el-tooltip v-if="type == 'refresh_icon_text_small'" placement="top" content="刷新">
    <el-button size="small" v-bind="{ ...attrs }" circle type="default" :icon="Refresh" @click="emit('click')" />
  </el-tooltip>
  <!-- 导入 -->
  <!--  <el-button v-if="type == 'import_icon_text'" v-bind="{ ...attrs }" :icon="Upload" type="primary" @click="emit('click')"-->
  <!--    >导入-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'import_icon_text'" placement="top" content="导入">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Download" @click="emit('click')" />
  </el-tooltip>
  <!-- 导出 -->
  <!--  <el-button v-if="type == 'export_icon_text'" v-bind="{ ...attrs }" :icon="Download" type="success" @click="emit('click')"-->
  <!--    >导出-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'export_icon_text'" placement="top" content="导出">
    <el-button v-bind="{ ...attrs }" circle type="default" :icon="Upload" @click="emit('click')" />
  </el-tooltip>
  <!-- 保存 -->
  <!--  <el-button-->
  <!--    size="small"-->
  <!--    v-if="type == 'save_icon_text'"-->
  <!--    v-bind="{ ...attrs }"-->
  <!--    :icon="Select"-->
  <!--    type="primary"-->
  <!--    @click="emit('click')"-->
  <!--    >保存-->
  <!--  </el-button>-->
  <el-tooltip v-if="type == 'save_icon_text'" placement="top" content="保存">
    <el-button size="small" v-bind="{ ...attrs }" circle type="default" :icon="Select" @click="emit('click')" />
  </el-tooltip>
  <el-button v-if="type == 'save_large_icon_text'" v-bind="{ ...attrs }" :icon="Select" type="primary" @click="emit('click')"
    >保存
  </el-button>
  <el-tooltip v-if="type == 'save_icon'" placement="top" content="保存">
    <el-button  v-bind="{ ...attrs }" circle type="default" :icon="Select" @click="emit('click')" />
  </el-tooltip>
  <el-tooltip v-if="type == 'start_save_icon'" placement="top" content="执行">
    <el-button  v-bind="{ ...attrs }" circle type="default" :icon="Select" @click="emit('click')" />
  </el-tooltip>
  <!-- 修改密码 -->
  <el-button v-if="type == 'password_text_plain'" v-bind="{ ...attrs }" type="warning" plain @click="emit('click')"
    >修改密码
  </el-button>
  <!-- 下载 -->
  <el-button v-if="type == 'download_text_plain'" v-bind="{ ...attrs }" type="success" plain @click="emit('click')"
    >下载
  </el-button>
  <el-button v-if="type == 'download_icon_text'" v-bind="{ ...attrs }" :icon="Download" type="success" @click="emit('click')"
    >下载
  </el-button>
  <el-tooltip v-if="type == 'download_icon'" placement="top" content="下载">
    <el-button
      v-if="type == 'download_icon'"
      v-bind="{ ...attrs }"
      :icon="Download"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>
  <el-tooltip v-if="type == 'download_code_icon'" placement="top" content="下载机器码">
    <el-button
      v-if="type == 'download_code_icon'"
      v-bind="{ ...attrs }"
      :icon="Download"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>
  <!--  恢复-->
  <el-tooltip v-if="type == 'backup_icon'" placement="top" content="恢复">
    <el-button
      v-if="type == 'backup_icon'"
      v-bind="{ ...attrs }"
      :icon="FirstAidKit"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>
  <!--  备份-->
  <el-tooltip v-if="type == 'sbackup_icon'" placement="top" content="备份">
    <el-button
      v-if="type == 'sbackup_icon'"
      v-bind="{ ...attrs }"
      :icon="FolderAdd"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>
  <!--  修改密码-->
  <el-tooltip v-if="type == 'key_icon'" placement="top" content="重置密码">
    <el-button
      v-if="type == 'key_icon'"
      v-bind="{ ...attrs }"
      :icon="Key"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>
  <!--  关闭-->
  <el-button
    v-if="type == 'close_icon'"
    v-bind="{ ...attrs }"
    :icon="Close"
    @click="emit('click')"
    type="default"
    circle
  ></el-button>
  <!--  新增-->
  <el-button
    v-if="type == 'insert_icon'"
    v-bind="{ ...attrs }"
    :icon="Plus"
    @click="emit('click')"
    type="default"
    circle
  ></el-button>
  <!--  取消-->
  <el-tooltip v-if="type == 'cancel_icon'" placement="top" content="取消">
    <el-button
      v-if="type == 'cancel_icon'"
      v-bind="{ ...attrs }"
      :icon="Close"
      @click="emit('click')"
      type="default"
      circle
    ></el-button>
  </el-tooltip>

  <!--  确定-->
  <el-button
    v-if="type == 'confirm_icon'"
    v-bind="{ ...attrs }"
    :icon="Check"
    @click="emit('click')"
    type="default"
    circle
  ></el-button>
</template>

<style scoped></style>
